package com.zh.business.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 描述: Spring Cloud 原生注解 @RefreshScope 实现配置自动更新
 *
 * @author: yanglin
 * @Date: 2021-10-29-16:08
 * @Version: 1.0
 */
@RestController
@RequestMapping("/config")
@RefreshScope
public class NacosConfigController {

    @Value("${useLocalCache:false}")
    private boolean useLocalCache;

    @RequestMapping("/get")
    public boolean get() {
        return useLocalCache;
    }
}
